package com.example.rwq_test.niuke.heap;

import java.util.ArrayList;
import java.util.Collections;

/**
 * TODO note
 *
 * @author renweiqiang
 * @version 1.0.0
 * @createTime 2024/1/2
 */
public class ListResort {
    public static void main(String[] args) {
        FloorInfo floorInfo1 = new FloorInfo();
        floorInfo1.setElevatorId(10);
        floorInfo1.setId(1);
        floorInfo1.setFloorNum("1层");
        FloorInfo floorInfo2 = new FloorInfo();
        floorInfo2.setElevatorId(10);
        floorInfo2.setId(-1);
        floorInfo2.setFloorNum("-1层");
        FloorInfo floorInfo3 = new FloorInfo();
        floorInfo3.setElevatorId(10);
        floorInfo3.setId(2);
        floorInfo3.setFloorNum("3层");
        FloorInfo floorInfo4 = new FloorInfo();
        floorInfo4.setElevatorId(10);
        floorInfo4.setId(1);
        floorInfo4.setFloorNum("4层");

        FloorInfo floorInfo5 = new FloorInfo();
        floorInfo5.setElevatorId(20);
        floorInfo5.setId(1);
        floorInfo5.setFloorNum("1层");
        FloorInfo floorInfo6 = new FloorInfo();
        floorInfo6.setElevatorId(20);
        floorInfo6.setId(-1);
        floorInfo6.setFloorNum("-1层");
        FloorInfo floorInfo7 = new FloorInfo();
        floorInfo7.setElevatorId(20);
        floorInfo7.setId(2);
        floorInfo7.setFloorNum("3层");
        FloorInfo floorInfo8 = new FloorInfo();
        floorInfo8.setElevatorId(20);
        floorInfo8.setId(1);
        floorInfo8.setFloorNum("4层");

        ArrayList<FloorInfo> list = new ArrayList<>();
        list.add(floorInfo1);
        list.add(floorInfo2);
        list.add(floorInfo3);
        list.add(floorInfo4);
        list.add(floorInfo5);
        list.add(floorInfo6);
        list.add(floorInfo7);
        list.add(floorInfo8);

        Collections.sort(list, new FloorComparator());
        for (FloorInfo floorInfo : list) {
            System.out.println(floorInfo.getElevatorId() + "->" + floorInfo.getId() + "->" + floorInfo.getFloorNum());
        }
    }
}
